<template>
  <div>
    <FilterTable ref="table" :columns="columns" :fetchapi="fetchApi" :params="fetchParams" :datakey="'records'" :isSelectColumn="false" :onColumnsChange="columns => (this.columns = columns)" />
  </div>
</template>

<script>
import { getQkgjxxList } from '@/api/customerRepair/callcenter/inbound';

export default {
  name: '',
  props: {
    phone: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      fetchApi: getQkgjxxList,
      fetchParams: this.phone ? { customerPhone: this.phone } : { xhrAbort: true },
      columns: this.createColumns()
    };
  },
  methods: {
    createColumns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 70,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '建立日期',
          dataIndex: 'createdAt',
          minWidth: 120,
          sorter: true,
          filter: true,
          filterType: 'date-range'
        },
        {
          title: '客户名称',
          dataIndex: 'customerName',
          minWidth: 100,
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '手机号',
          dataIndex: 'mobilePhone',
          minWidth: 100,
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '意向车系',
          dataIndex: 'intentSeriseName',
          minWidth: 150,
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '意向车型',
          dataIndex: 'intentModelName',
          minWidth: 150,
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '销售顾问',
          dataIndex: 'consultant',
          minWidth: 100,
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '进店次数',
          dataIndex: 'shopTime',
          minWidth: 100,
          sorter: true,
          filter: true,
          filterType: 'number'
        }
      ];
    }
  }
};
</script>
